import React, { Component } from 'react'
import { Button } from 'antd'
import Child from './Child'

export default class componentName extends Component {
  constructor(props) {
    super(props)
    this.state = {
      childValue: '我i初始值',
    }
  }
  changeValue = () => {
    this.setState({
      childValue: '随机数' + Math.random(),
    })
  }
  render() {
    return (
      <div>
        <h2>我是父级组件</h2>
        <Button onClick={this.changeValue}>点击我，自组件数据会变</Button>
        <Child childValue={this.state.childValue} />
        <div>
          但是，如果自组件shouldComponentUpdate函数return false;则自组件不会变化
        </div>
      </div>
    )
  }
}
